package demo15;

/**
 * @program: qy158
 * @description:
 * @author: 闫克起2
 * @create: 2022-11-01 10:36
 **/
public class Girl extends Thread {
    @Override
    public void run() {
        synchronized (LockObject.lock2){
            System.out.println(Thread.currentThread().getName()+"获取一个筷子");
            synchronized (LockObject.lock1){
                System.out.println(Thread.currentThread().getName()+"获取另一个筷子");
                System.out.println(Thread.currentThread().getName()+"可以吃饭了");
            }
        }
    }
}
